import java.text.BreakIterator;

/**
 * Created by IntelliJ IDEA.
 * User: James Barker
 * Date: 2/08/11
 * Time: 3:58 PM
 * To change this template use File | Settings | File Templates.
 */
public class ElevatorController {

    Elevator e;

    public ElevatorController(int minFloor, int maxFloor) {
        e = new Elevator(minFloor, maxFloor);
    }

    public void moveElevator(int destinationFloor) {
        while (true) {
            if (e.getCurrentFloor() == destinationFloor) {
                System.out.println("<<<<<     SAME FLOOR     >>>>>");
                break;
            }
            else if (e.getCurrentFloor() < destinationFloor) {
                e.setCurrentFloor(e.getCurrentFloor()+1);
                System.out.println("<<<<<     MOVING UP     >>>>>");
            }
            else if (e.getCurrentFloor() > destinationFloor) {
                e.setCurrentFloor(e.getCurrentFloor()-1);
                System.out.println("<<<<<     MOVING DOWN     >>>>>");
            }
            else {
                System.out.println("WE GOT PROBLEMS RIGHT HERE MATE!!!");
                break;
            }
        }


    }
}
